﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp {
    class Program {
        static void Main(string[] args) {
            var input = Console.ReadLine();
            int number = 0;

            if (int.TryParse(input, out number)) {
                var result = Result(number - 1, 3) + Result(number - 1, 5);
                Console.WriteLine(result.ToString());
            }

            Console.ReadKey();
        }

        private static int Result(int number, int multiple) {
            if (number < 1) {
                return 0;
            }

            if ((number % multiple) == 0) {
                return number + Result(number - 1, multiple);
            }

            return Result(number - 1, multiple);
        }
    }
}
